package com.dd.duu.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.dc.entity.users.DPermission;
import com.dd.duu.service.fallback.PermissionFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 描述: 用户菜单权限Feign
 *
 * @author: yanglin
 * @Date: 2021-03-08-16:16
 * @Version: 1.0
 */
@FeignClient(value = "dd-user-service", fallbackFactory = PermissionFallBackFactory.class)
public interface PermissionClient {

    @PostMapping(value = "/user/d-permission/findPermissionByUserId")
    List<DPermission> findPermissionByUserId(@RequestParam Integer userId);

    @PostMapping(value = "/user/d-permission/findPermissionByRoleId")
    List<DPermission> findPermissionByRoleId(@RequestBody List<Integer> userId);

    @PostMapping("/user/d-permission/queryPermissionList")
    Page<DPermission> queryPermissionList(@RequestParam int page, @RequestParam int limit, @RequestParam String permissionName);

    @PostMapping("/user/d-permission/insert")
    Integer insert(@RequestBody DPermission permission);

    @PostMapping("/user/d-permission/updateById")
    boolean updateById(@RequestBody DPermission permission);

    @DeleteMapping("/user/d-permission/delete")
    boolean delete(@RequestParam Integer roleId);
}
